﻿using Furion.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using todo.Core.Configuration;
using todo.EntityFramework.Entities;
using todo.EntityFramework.FromBody;
using todo.EntityFramework.ViewModels.UI;
using todo.IRepository;

namespace todo.Repository
{
    public class DoBooksRepository : BaseRepository<DoBooks>, IDoBooksRepository, ITransient
    {
        public DoBooksRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
        {
        }

        public async Task<AdminUiCallBack> InsertAsync(DoBooks entity)
        {
            var jm = new AdminUiCallBack();
            int bl ;
            bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync();
            jm.data = entity;
            jm.code = bl>0 ? 0 : 1;
            jm.msg = bl >0 ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
            return jm;
        }

        public Task<AdminUiCallBack> UpdateAsync(DoBooks entity)
        {
            throw new NotImplementedException();
        }
    }
}
